<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>成员修改</title>
    <script src="../layui/layui.js"></script>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <script src="../js/jquery.js"></script>
    <script src="../js/myAjax.js"></script>
    <script src="../js/util/popup.js"></script>
    <script src="../js/util/getGroupLeader.js"></script>
</head>
<body>
<div style="margin-left: 100px; margin-top: 100px">
    <div class="layui-form-item">
        <label class="layui-form-label">用户名：</label>
        <div class="layui-input-inline">
            <input type="text" name="title" readonly required lay-verify="required" id="userName" autocomplete="off"
                   class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux" style="color: red">无法操作！</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所在小组：</label>
        <div class="layui-input-inline">
            <input type="text" name="title" readonly required lay-verify="required" id="groupName" autocomplete="off"
                   class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux" style="color: red">无法操作！</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">添加时间：</label>
        <div class="layui-input-inline"> <!-- 注意：这一层元素并不是必须的 -->
            <input type="text" readonly  class="layui-input" id="addTime">
        </div>
        <div class="layui-form-mid layui-word-aux">无法操作！</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否组长：</label>
        <div class="layui-input-inline"> <!-- 注意：这一层元素并不是必须的 -->
            <input type="text" readonly  class="layui-input" id="isLeader">
        </div>
        <div class="layui-form-mid layui-word-aux">无法操作！</div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" onclick="confirmClose()">确认</button>
            <button type="reset" onclick="resetEdit('/html/groupMemberEdit.html')" class="layui-btn layui-btn-primary">
                点击重置
            </button>
        </div>
    </div>
</div>
<script>
    layui.use("layer");
    function confirmClose(){
        parent.layer.closeAll();
    }
    //点击编辑页面，通过id去后台查询获得数据给编辑页面进行赋值
    let id = sessionStorage.getItem("group-member-user-id")
    findById('/member/findById',id);
    function findById(url,id) {
        let result = myAjax(url,'post',{id:id});
        $("#userName").val(result.userName);
        $("#groupName").val(result.groupName);
        $("#addTime").val(result.addTime);
        if (result.isLeader==1){
            $("#isLeader").val("是");
        }else {
            $("#isLeader").val("否");
        }

    }
</script>
</body>
</html>